package com.example.antdback.config;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;


/**
 * @author ljg
 * description json全局序列化配置
 * @since 2021/8/29 11:44 上午
 **/
@Configuration
@ConditionalOnClass(JSON.class)
public class FastJsonConfiguration {
    static {
        //map为空的字段也要展示
        JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteMapNullValue.getMask();
        //日期格式标准展示yyyy-MM-dd HH:mm:ss
        JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteDateUseDateFormat.getMask();
    }
}